<div class="panel panel-default">
    <div class="panel-body">
        <div class="form-horizontal form-border">
            <div class="form-group">
                <label class="col-sm-3 control-label">标题:</label>
                <div class="col-sm-6">
                    <input type="text" id="article-title" class="form-control" value="$article.article_name">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">描述:</label>
                <div class="col-sm-6">
                    <input type="text" id="article-desc" class="form-control" value="$article.simple_desc">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">上传图片：</label>
                <div class="col-sm-6">
                    <ul class="img-list col-sm-12" id="imageList">
                        <li>#if($article.img_url)<img src='$article.img_url'>#end</li><i></i>
                    </ul>
                    <div class="col-sm-12 img-add" data-bind="visible: model.formEntity.bannerImgurl().length < 1">
                        <input type="file" placeholder="选择图片" class="form-control"  id="file_sequence_id_1" name="file_sequence_name_2" accept=".jpg,.jpeg,.bmp,.png">
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">资讯内容：</label>
        </div>
        <div class="panel-body panel-body-ext">
            <div id="editor-trigger">$article.content</div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-8 col-sm-2">
                <button type="submit" id="submitBtn" data-id ="$article.id" class="btn btn-primary">确定</button>
                <button type="submit" class="btn btn-primary">取消</button>
            </div>
        </div>
    </div>
</div>
<!--Global JS-->
<script src="/shop/article/editArticle.js"></script>
<script>


    var editor = new wangEditor('editor-trigger');

    // 上传图片
    editor.config.uploadImgUrl = '/upload';
    editor.config.uploadParams = {
        // token1: 'abcde',
        // token2: '12345'
    };
    editor.config.uploadHeaders = {
        // 'Accept' : 'text/x-json'
    }
    // editor.config.uploadImgFileName = 'myFileName';

    // 隐藏网络图片
    // editor.config.hideLinkImg = true;

    // 表情显示项
    editor.config.emotionsShow = 'value';


    // onchange 事件
    editor.onchange = function () {
        console.log(this.$txt.html());
    };

    editor.create();

    function preview(file){
        var prevDiv = document.getElementById('preview');
        if (file.files && file.files[0]){
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" />';
            }
            reader.readAsDataURL(file.files[0]);
        } else {
            prevDiv.innerHTML =
                    '<div class="img" ' +
                    'style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' +
                    '(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }
</script>





